toMap

abstract fun toMap(): Map<Any, Any>

Converts this map to a Map.

The type mapping rules for the map elements are the following:


| JavaScript         | Java           |
|--------------------|----------------|
| Number             | Double         |
| String             | String         |
| Boolean            | Boolean        |
| null and undefined | null           |
| Node               | Node, JsObject |
| ArrayBuffer        | byte[]         |
| Array              | List<?>        |
| Set                | Set<?>         |
| Map                | Map<?,?>       |
| Object             | JsObject       |
| Proxy Object       | Object         |

Proxy objects are mapped to the corresponding injected Java object.

Return

a map containing the converted key-value pairs from this map

Throws

when the JavaScript object is already disposed or invalid


abstract fun <K, V> toMap(keyType: Class<K>, valueType: Class<V>): Map<K, V>

Converts this map to a Map.

The type mapping rules for the map elements are the following:


| JavaScript         | Java           |
|--------------------|----------------|
| Number             | Double         |
| String             | String         |
| Boolean            | Boolean        |
| null and undefined | null           |
| Node               | Node, JsObject |
| ArrayBuffer        | byte[]         |
| Array              | List<?>        |
| Set                | Set<?>         |
| Map                | Map<?,?>       |
| Object             | JsObject       |
| Proxy Object       | Object         |

Proxy objects are mapped to the corresponding injected Java object.

All keys in this map must be of a type convertible to the type K and values must be of a type convertible to the type V according to the mapping rules.

Return

a map containing the converted key-value pairs from this map

Parameters

keyType

the Java type to convert the keys in this map to, according to the mapping rules

valueType

the Java type to convert the values in this map to, according to the mapping rules

<K>

the type of the converted keys

<V>

the type of the converted values

Throws

when the JavaScript object is already disposed or invalid